package cate.game.res.treasureturntable;

import cate.common.table.d.GDTreasureTurntable;
import cate.game.db.facade.KvLoader;
import cate.game.db.mongo.kv.KvMongo;
import cate.game.framework.ModuleMan;

public class TreasureTurntableManager extends ModuleMan {
    public TreasureTurntableSPO data;

    @Override
    public void initDependent() throws Exception {
        data = new KvLoader<>(game, TreasureTurntableSPO.class, KvMongo.KEY_TREASURE_TURNTABLE).getBySrvId();
    }

    public void addLog(byte turntableType, TreasureTurntableLogDetail log) {
        data.addLog(turntableType, log, GDTreasureTurntable.LOG_SIZE);
    }

    public TreasureTurntableLog getLog(byte type){
        return data.getLog(type);
    }

    @Override
    public void shutdown(){
        game.db.kv.save(data);
    }
}
